#!usr/bin/env python3
# _*_ coding:utf-8 _*_
from functools import reduce
# 需要实现的功能，删选出4的倍数
num = [1,2,23,34,4,44,8,22,2,80]
def filter4(num):
    def is4(n):
        if n % 4 == 0:
            return n
    return list(filter(is4,num))
# print(filter4(num))

#实现一个素数的生成器

def produce_primes_within(times):
    def primes():
        #构造一个从3开始的奇数序列
        def odd_iter():
            n = 1
            while True:
                n = n + 2
                yield n
        def not_divisible(n):
            return lambda x: x % n > 0
        yield 2
        it = odd_iter()
        while True:
            n = next(it)
            yield n #返回序列的第一个数，就是素数
            it = filter(not_divisible(n),it)

    for value in primes():
        if value < times:
            print (value)
        else:
            return

# produce_primes_within(100)

def test_list():
    num = [12,129,1,2,1,9]
    num1 = num[::-1]
    print('num=',num)
    print('num1=',num1)

def huishu(times):
    n=[]
    for value in range(times):
        n1 = str(value)
        n2 = n1[::-1]
        if n1 == n2:
            n.append(value)
    return n
print(huishu(1000))
